<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body {
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            flex-direction: column;
        }

        .box {
            width: 300px;
            height: 300px;
            text-align: center;
            line-height: 300px;
            border-radius: 35px;
            background-color: cornflowerblue;
        }
    </style>

</head>

<body>
    <button>点我懒加载</button>
    <script>
        // 4.懒加载
        document.querySelector('button').onclick = function () {
            // import('./ESM模块化/lazy.js')
            import('./ESM模块化/lazy.js').then(res => {
                //这里的res就lazy中的导出的内容
                console.log(res);
                console.log(res.default);//打印lazy,lazy是默认输出
                console.log(res.num);//打印num
            })
        }
    </script>
</body>

</html>